package com.ihelp.controller;

import com.ihelp.entities.CommonResult;
import com.ihelp.pojo.EvaluateLevel;
import com.ihelp.pojo.HospitalDepartment;
import com.ihelp.service.EvaluateLevelService;
import com.ihelp.service.HospitalDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LiuZiMing
 * @since 2023-06-07
 */
@RestController
@RequestMapping("/evaluateLevel")
public class EvaluateLevelController {
    @Autowired
    private EvaluateLevelService evaluateLevelService;

    @GetMapping("/all")
    public CommonResult getAllEvaluateLevel() {
        List<EvaluateLevel> allEvaluateLevel = evaluateLevelService.getAllEvaluateLevel();
        return new CommonResult(200, "获取所有评价等级成功", allEvaluateLevel);
    }

    @GetMapping("/id/{id}")
    public CommonResult getAllEvaluateLevelById(@PathVariable Integer id){
        EvaluateLevel evaluateLevelById = evaluateLevelService.getAllEvaluateLevelById(id);
        if(evaluateLevelById!=null){
            return new CommonResult<>(200,"根据id:"+id+",获取评价等级成功",evaluateLevelById);
        }else {
            return new CommonResult<>(204,"根据id:"+id+",未找到评价等级");
        }
    }
}
